package com.ujiuye.web;

import com.ujiuye.service.StuService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/delete")
public class DeServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        PrintWriter pw = resp.getWriter();
        StuService ss = new StuService();
        boolean b = ss.deStu(id);
        if (b) {
            //删除成功-->重新显示学生信息
            resp.sendRedirect("show");
        } else {
            pw.println("删除失败");
        }
    }
}
